$ (function() {
    window.onload = function(){
        $.ajax({
            url: 'http://localhost:3000/report/hot',
            method: 'get',
            success: function(res){
                var sdd = [];
                var str = '';
                for(var i = 0; i<8 ;i++){
                    sdd.push(res[i])
                }
                $.each(sdd,function(index,item){
                    str += "<div class=report-concent>"+
                    "<img src="+item.img+" width=250px>"+
                    "<p>"+item.text+"</p>"+
                    "<p>"+
                        "<span>"+item.uName+"</span>"+
                        "<span class=zan>"+
                            "<img src=./img/zan.png width=15px> 3"+
                            "<img src=./img/reply.png width=15px> 3"+
                        "</span>"+
                    "</p>"+
                "</div>"
                })
                $('.report').html(str);
            }
        })
        $.ajax({
            url:'http://localhost:3000/guid/new',
            method:'get',
            success: function(st){
                var btn = [];
                var str_ = '';
                for(var i = 0; i<4 ;i++){
                    btn.push(st[i])
                }
                $.each(btn,function(index,item){
                    str_+= "<div class=shopping-1>"+
                    "<img src="+item.img+" width=250px>"+
                    "<p>"+ item.text +"</p>"+
                    "<p class=zan-1>"+
                        "<img src=./img/zan.png width=15px> 3"+
                        "<img src=./img/reply.png width=15px> 3"+
                    "</p>"+
                    "</div>"
                })
                $('.shopping').html(str_);
            }
        })
        $.ajax({
            url:'http://localhost:3000/play/new',
            method:'get',
            success:function(res){
                var sdd = [];
                var str = '';
                for(var i = 0; i<3 ;i++){
                    sdd.push(res[i])
                }
                console.log(sdd);
                $.each(sdd,function(index,item){
                    $.each(item,function(i,a){
                        str+="<div class=coldplay-1>"+
                        "<img src="+a.img+" width=250px>"+
                        "<p>"+a.description+"</p>"+
                        "<p class=kuwan>"+a.text+"</p>"+
                        "<br>"+
                        "<p>"+
                            "<span class=price>"+a.price+"</span>"+
                            "<span class=zan-2>"+
                                "<img src=./img/zan.png width=15px>" +a.like+
                                "<img src=./img/reply.png width=15px>" +a.words+
                            "</span>"+
                        "</p>"+
                    "</div>"
                    })
                    $('.coldplay').html(str);
                })
            }
        })
    }
})
$('.click').click(function(){
    $('.coldplay').css('height','1500px');
    $('.center').css('height','3500px');
    $('.click').hide();
})